﻿using UnityEngine;
using System.Collections;

public class dinhero : MonoBehaviour 
{
	public Vector3 scale;
	public Vector3 position;
	public Vector3 positionInverse;
	Vector3 inverted;
	public GameObject player;
	public bool inversion;

	void Start () 
	{
		scale = transform.localScale;
		positionInverse = transform.position*-1;
		inverted = new Vector3(-scale.x, scale.y,1);
	}
	void Update () 
	{	
		position = transform.position;
		inversion = player.GetComponent<Player>().inversion;
		if(inversion)
		{
			transform.localScale = inverted;
			transform.position = new Vector3(positionInverse.x,position.y,position.z);
		}
		else
		{
			transform.localScale = scale;
			transform.position = position;
		}
	}
}
